package org.jeecg.modules.health_records.health_activity.service.impl;

import org.jeecg.modules.health_records.health_activity.entity.HealthActivityInfo;
import org.jeecg.modules.health_records.health_activity.mapper.HealthActivityInfoMapper;
import org.jeecg.modules.health_records.health_activity.service.IHealthActivityInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 健康活动记录
 * @Author: jeecg-boot
 * @Date:   2025-06-30
 * @Version: V1.0
 */
@Service
public class HealthActivityInfoServiceImpl extends ServiceImpl<HealthActivityInfoMapper, HealthActivityInfo> implements IHealthActivityInfoService {

    @Autowired
    private HealthActivityInfoMapper healthActivityInfoMapper;
    /**按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthActivityInfo> queryByRecordId(HealthActivityInfo healthActivityInfo) {
        return healthActivityInfoMapper.queryByRecordId(Long.valueOf(healthActivityInfo.getRecordid()), healthActivityInfo.getIdNumber());

    }
    //新规则查询当下时间往前12个月的就诊数据作为电子病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthActivityInfo> newQueryElecRecord(HealthActivityInfo healthActivityInfo) {
        return healthActivityInfoMapper.newQueryElecRecord(Long.valueOf(healthActivityInfo.getRecordid()),healthActivityInfo.getSeeId(),healthActivityInfo.getIdNumber());

    }

    //新规则：除去当下时间往前12个月的就诊数据，剩下的数据为既往病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthActivityInfo> newQueryPastRecord(HealthActivityInfo healthActivityInfo) {
        return healthActivityInfoMapper.newQueryPastRecord(Long.valueOf(healthActivityInfo.getRecordid()),healthActivityInfo.getSeeId(),healthActivityInfo.getIdNumber());

    }
}
